<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        [v-cloak]{
            display: none;
        }
    </style>
</head>
<body>
    <div id='app'>
        <li v-cloak v-for="item in newsList" :key='item.id'>{{item.title}}</li>
    </div>
    <script src="../vue.js"></script>
    <script src="../jquery-3.6.0.min.js"></script>
    <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
    <script>
        new Vue({
            el:'#app',
            data () {
                return {
                    newsList:[],
                }
            },
            methods: {
                getNewsList(){
                    axios({
                    method:'post',
                    url:'http://macio.ncyateng.com/api/news/index',
                }).then((res)=>{
                    let {data:{newsList}}=res;  //解构
                    this.newsList=newsList;
                })
                }
            },
            created () {
                this.getNewsList();
            }
        })

    </script>
</body>
</html>